With refinement of elements and an increase in memory capacity, a NAND type flash memory with a three-dimensional structure has been developed. According to such NAND type flash memory, a threshold voltage of a previously written memory cell may vary if data is written subsequently in a different memory cell.